﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PMSSys
{
    public partial class InitialClinicalDataView : Form
    {
        private String last_id, templast_id;
        private ICD pasyenteICD = new ICD();
        public InitialClinicalDataView()
        {
        }
        public InitialClinicalDataView(Patient pObject, patientController pc)
        {
            InitializeComponent();
            icdprocessor = new icdController();
            icdprocessor.DbConnect = pc.DbConnect;
            last_id = pObject.PatientID.ToString();

        }
        public InitialClinicalDataView(Patient pObject, patientController pc, bool lolo)
        {
            InitializeComponent();
            icdprocessor = new icdController();
            icdprocessor.DbConnect = pc.DbConnect;
            last_id = pObject.PatientID.ToString();
            pasyenteICD.PatientID = int.Parse(last_id);
            icdprocessor.objectFiller(pasyenteICD);
            textBox1.Text = pasyenteICD.Chiefcomplaint;
            richTextBox1.Text = pasyenteICD.Hpi;
            checkBox1.Checked = pasyenteICD.Bcg;
            checkBox2.Checked = pasyenteICD.Dtp;
            checkBox4.Checked = pasyenteICD.Hib;
            checkBox6.Checked = pasyenteICD.Mmr;
            checkBox8.Checked = pasyenteICD.Hpv;
            checkBox3.Checked = pasyenteICD.Opvipv;
            checkBox7.Checked = pasyenteICD.Vari;
            iHOthersheckbox.Checked = pasyenteICD.Otherimmunizationcheck;
            iHOtherstextBox.Text = pasyenteICD.Otherimmunization;
            checkBox10.Checked = pasyenteICD.Familycancerbox;
            textBox3.Text = pasyenteICD.Familycancer;
            checkBox11.Checked = pasyenteICD.Familyhemo;
            checkBox12.Checked = pasyenteICD.Familyvwf;
            checkBox13.Checked = pasyenteICD.Familyanemiabox;
            textBox4.Text = pasyenteICD.Familyanemia;
            checkBox14.Checked = pasyenteICD.Familyothers;
            textBox5.Text = pasyenteICD.Familyothersnotes;
            checkBox15.Checked = pasyenteICD.Pastillnessbox;
            textBox6.Text = pasyenteICD.Pastillness;
            checkBox16.Checked = pasyenteICD.Pastsurgerybox;
            textBox7.Text = pasyenteICD.Pastsurgery;
            checkBox17.Checked = pasyenteICD.Pastmedicationsbox;
            textBox8.Text = pasyenteICD.Pastmedications;
            checkBox18.Checked = pasyenteICD.Pastallergybox;
            richTextBox4.Text = pasyenteICD.Allergies;
            richTextBox2.Text = pasyenteICD.Envirohistory;
            richTextBox3.Text = pasyenteICD.Psychohistory;
            textBox9.Text = pasyenteICD.Vitalt;
            textBox10.Text = pasyenteICD.Vitalbsa;
            textBox11.Text = pasyenteICD.Vitalbp;
            textBox12.Text = pasyenteICD.Vitalhr;
            textBox13.Text = pasyenteICD.Vitalpain;
            textBox14.Text = pasyenteICD.Vitalrr;
            textBox15.Text = pasyenteICD.Vitalheight;
            textBox16.Text = pasyenteICD.Vitalweight;
            textBox17.Text = pasyenteICD.Vitalperform_lev;
            radioButton1.Checked = pasyenteICD.Skinnolesions;
            radioButton2.Checked = pasyenteICD.Skinlesions;
            textBox18.Text = pasyenteICD.Skinlesionsnotes;
            textBox19.Text = pasyenteICD.Skinlocation;
            checkBox19.Checked = pasyenteICD.Heent_conj_normal;
            checkBox20.Checked = pasyenteICD.Heent_conj_pale;
            checkBox21.Checked = pasyenteICD.Heent_sclerae_normal;
            checkBox23.Checked = pasyenteICD.Heent_sclerae_yellow;
            checkBox22.Checked = pasyenteICD.Heent_thyr_normal;
            checkBox24.Checked = pasyenteICD.Heent_thyr_enlarged;
            textBox20.Text = pasyenteICD.Heent_thyr_enlargednotes;
            checkBox25.Checked = pasyenteICD.Heent_crn_normal;
            checkBox26.Checked = pasyenteICD.Heent_crn_enlarged;
            textBox21.Text = pasyenteICD.Heent_crn_enlargednotes;

            checkBox28.Checked = pasyenteICD.Heent_tonsils_normal;

            checkBox27.Checked = pasyenteICD.Heent_tonsils_enlarged;

            checkBox29.Checked = pasyenteICD.Heent_tonsils_exudates;

            checkBox30.Checked = pasyenteICD.Heent_tonsils_beefy;

            checkBox31.Checked = pasyenteICD.Heent_tm_normal;

            checkBox32.Checked = pasyenteICD.Heent_tm_perforated;

            checkBox33.Checked = pasyenteICD.Heent_tm_discharged;
            checkBox34.Checked = pasyenteICD.Chestrythm_regu;

            checkBox35.Checked = pasyenteICD.Chestrythm_irreg;

            checkBox36.Checked = pasyenteICD.Chestrythm_murmur;

            checkBox37.Checked = pasyenteICD.Chestrythm_thrill;
            textBox22.Text = pasyenteICD.Chestbreast_smr;

            radioButton4.Checked = pasyenteICD.Lungsnormal;


            radioButton3.Checked = pasyenteICD.Lungsabnormal;


            textBox24.Text = pasyenteICD.Lungsabnormalnotes;

            radioButton6.Checked = pasyenteICD.Extremitiesnormal;

            radioButton5.Checked = pasyenteICD.Extremitiesabnormal;


            textBox23.Text = pasyenteICD.Extremitiesabnormalnotes;

            radioButton8.Checked = pasyenteICD.Rectalnormal;

            radioButton7.Checked = pasyenteICD.Rectalabnormal;


            textBox25.Text = pasyenteICD.Rectalabnormalnotes;

            radioButton10.Checked = pasyenteICD.Endocrinenormal;

            radioButton9.Checked = pasyenteICD.Endocrineabnormal;


            textBox26.Text = pasyenteICD.Endocrineabnormalnotes;

            radioButton12.Checked = pasyenteICD.Hematologicnormal;

            radioButton11.Checked = pasyenteICD.Hematologicabnormal;


            richTextBox5.Text = pasyenteICD.Hematologicabnormalnotes;

            radioButton14.Checked = pasyenteICD.Genitalianormal;

            radioButton13.Checked = pasyenteICD.Genitaliaabnormal;

            textBox27.Text = pasyenteICD.Genitaliaabnormalnotes;
            textBox28.Text = pasyenteICD.Smrrating;
            richTextBox6.Text = pasyenteICD.Phys_others;
            richTextBox7.Text = pasyenteICD.Phys_perflevel;
            textBox37.Text =  pasyenteICD.Cbchgb;
            textBox35.Text = pasyenteICD.Cbchct;
            textBox33.Text = pasyenteICD.Cbcwbc;
            textBox32.Text = pasyenteICD.Cbcstabs;
            textBox29.Text = pasyenteICD.Cbcseg;
            textBox30.Text = pasyenteICD.Cbcl;
            textBox31.Text = pasyenteICD.Cbcplatelet;
            textBox34.Text = pasyenteICD.Cbcm;
            textBox36.Text = pasyenteICD.Cbce;
            textBox38.Text = pasyenteICD.Cbcblast;
            textBox39.Text = pasyenteICD.Cbcreticulyte_count;
            textBox40.Text = pasyenteICD.Cbcrpi;

            checkBox38.Checked = pasyenteICD.Cbcmcv;


            textBox43.Text = pasyenteICD.Cbcmcvnotes;

            checkBox39.Checked = pasyenteICD.Cbcmch;


            textBox42.Text = pasyenteICD.Cbcmchnotes;

            checkBox40.Checked = pasyenteICD.Cbcmchc;


            textBox41.Text = pasyenteICD.Cbcmchcnotes;

            checkBox41.Checked = pasyenteICD.Perismearrbc;
            checkBox42.Checked = pasyenteICD.Perismearaniso;


            textBox44.Text = pasyenteICD.Perismearrbcnotes;

            checkBox24.Checked = pasyenteICD.Perismearaniso;
            textBox45.Text = pasyenteICD.Perismearanisonotes;
            checkBox43.Checked = pasyenteICD.Perismearpoikilo;



            textBox46.Text = pasyenteICD.Perismearpoikilonotes;

            checkBox44.Checked = pasyenteICD.Perismearwbc;



            textBox47.Text = pasyenteICD.Perismearwbcnotes;
            textBox48.Text = pasyenteICD.Perismearb;
            textBox49.Text = pasyenteICD.Perismearn;
            textBox50.Text = pasyenteICD.Perismearl;
            textBox51.Text = pasyenteICD.Perismear2b;
            textBox52.Text = pasyenteICD.Perismeare;
            textBox53.Text = pasyenteICD.Perismearm;
            textBox54.Text = pasyenteICD.Perismearblast;

            checkBox45.Checked = pasyenteICD.Perismearplatelets;
            textBox55.Text = pasyenteICD.Perismearadeq;
            textBox56.Text = pasyenteICD.Perismearinc;
            textBox57.Text = pasyenteICD.Perismeardec;
            textBox58.Text = pasyenteICD.Perismearmacro;
            textBox59.Text = pasyenteICD.Perismearmicro;
            richTextBox8.Text = pasyenteICD.Perismearinterpre;
            textBox61.Text = pasyenteICD.Coagprofblledtime;
            textBox62.Text = pasyenteICD.Coagprofclottime;
            textBox64.Text  = pasyenteICD.Coagprofpt;
            textBox65.Text = pasyenteICD.Coagprofaptt;
            textBox66.Text = pasyenteICD.Coagproffdp;
            textBox67.Text = pasyenteICD.Coagprofothers;
            textBox62.Text = pasyenteICD.Coagprofviii;
            textBox63.Text = pasyenteICD.Coagprofix;
            textBox68.Text = pasyenteICD.Coagproffibri;
            textBox69.Text = pasyenteICD.Coagprofdmmers;
            richTextBox9.Text = pasyenteICD.Plateaggregationtests;
            richTextBox10.Text = pasyenteICD.Hemoglobinelectronotes;
            textBox70.Text = pasyenteICD.Bonemsmerythropoiesis;
            textBox71.Text = pasyenteICD.Bonemsmgranulopoiesis;
            textBox72.Text = pasyenteICD.Bonemsmmegakaryopoiesis;
            textBox73.Text = pasyenteICD.Bonemsmothers;
            textBox74.Text = pasyenteICD.Bonemsminterpretations;
            dateTimePicker1.Value = pasyenteICD.Bonemrbiopsydate;
            richTextBox11.Text = pasyenteICD.Bonemrbiopsynotes;
            dateTimePicker2.Value = pasyenteICD.Histopathologydate;
            richTextBox12.Text = pasyenteICD.Histopathologynotes;
            dateTimePicker3.Value = pasyenteICD.Chromodate;
            richTextBox13.Text = pasyenteICD.Chromonotes;
            dateTimePicker4.Value = pasyenteICD.Cytochemdate;
            textBox75.Text = pasyenteICD.Cytochempas;
            textBox76.Text = pasyenteICD.Cytochemmpo;
            textBox77.Text = pasyenteICD.Cytochemsbb;
            textBox78.Text = pasyenteICD.Cytochemothers;

            dateTimePicker5.Value = pasyenteICD.Immunophenodate;
            textBox79.Text = pasyenteICD.Immunophenocd3;
            textBox80.Text = pasyenteICD.Immunophenocd5;
            textBox81.Text = pasyenteICD.Immunophenocd7;
            textBox82.Text = pasyenteICD.Immunophenocd10;
            textBox83.Text = pasyenteICD.Immunophenocd13;
            textBox85.Text = pasyenteICD.Immunophenocd19;
            textBox86.Text = pasyenteICD.Immunophenocd20;
            textBox87.Text = pasyenteICD.Immunophenocd22;
            textBox88.Text = pasyenteICD.Immunophenocd33;
            textBox89.Text = pasyenteICD.Immunophenocd34;
            textBox90.Text = pasyenteICD.Immunophenoantihladr;
            textBox91.Text = pasyenteICD.Immunophenoothers;

            dateTimePicker8.Value = pasyenteICD.Bonescandate;
            richTextBox16.Text = pasyenteICD.Bonescannotes;
            dateTimePicker7.Value = pasyenteICD.Ctscandate;
            richTextBox15.Text = pasyenteICD.Ctscannotes;
            dateTimePicker6.Value = pasyenteICD.Chestxraydate;
            richTextBox14.Text = pasyenteICD.Chestxraynotes;
            richTextBox17.Text = pasyenteICD.Labdataothers;
            textBox92.Text = pasyenteICD.Impressiondiagnosis;
            textBox93.Text = pasyenteICD.Othernotes;
            isModified = false;
        }
        private bool isModified = false;
        private icdController icdprocessor;
        private icdController tempporocessor;
        private void closeLogic(object sender, EventArgs e)
        {
            this.Close();
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            isModified = true;
        }

        private void iHOthersheckbox_CheckedChanged(object sender, EventArgs e)
        {
            iHOtherstextBox.Enabled = iHOthersheckbox.Checked;
            if (!iHOthersheckbox.Checked)
                iHOtherstextBox.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void cancerCheckbox(object sender, EventArgs e)
        {
            textBox3.Enabled = checkBox10.Checked;
            if (!checkBox10.Checked)
                textBox3.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void anemiaCheckbox(object sender, EventArgs e)
        {
            textBox4.Enabled = checkBox13.Checked;
            if (!checkBox13.Checked)
                textBox4.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox14_CheckedChanged(object sender, EventArgs e)
        {
            textBox5.Enabled = checkBox14.Checked;
            if (!checkBox14.Checked)
                textBox5.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox15_CheckedChanged(object sender, EventArgs e)
        {
            textBox6.Enabled = checkBox15.Checked;
            if (!checkBox15.Checked)
                textBox6.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox16_CheckedChanged(object sender, EventArgs e)
        {
            textBox7.Enabled = checkBox16.Checked;
            if (!checkBox16.Checked)
                textBox7.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox17_CheckedChanged(object sender, EventArgs e)
        {
            textBox8.Enabled = checkBox17.Checked;
            if (!checkBox17.Checked)
                textBox8.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox18_CheckedChanged(object sender, EventArgs e)
        {
            richTextBox4.Enabled = checkBox18.Checked;
            if (!checkBox18.Checked)
                richTextBox4.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            textBox18.Enabled = radioButton2.Checked;
            textBox19.Enabled = radioButton2.Checked;

            if (!radioButton2.Checked)
            {
                textBox18.Clear();
                textBox19.Clear();
            }
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox24_CheckedChanged(object sender, EventArgs e)
        {
            textBox20.Enabled = checkBox24.Checked;
            if (!checkBox24.Checked)
                textBox20.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox26_CheckedChanged(object sender, EventArgs e)
        {
            textBox21.Enabled = checkBox26.Checked;
            if (!checkBox26.Checked)
                textBox21.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            textBox24.Enabled = radioButton3.Checked;
            if (!radioButton3.Checked)
            {
                textBox24.Clear();
            }
            checkBox1_CheckedChanged(sender, e);
        }

        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {
            textBox23.Enabled = radioButton5.Checked;
            if (!radioButton5.Checked)
            {
                textBox23.Clear();
            }
            checkBox1_CheckedChanged(sender, e);
        }

        private void radioButton7_CheckedChanged(object sender, EventArgs e)
        {
            textBox25.Enabled = radioButton7.Checked;
            if (!radioButton7.Checked)
            {
                textBox25.Clear();
            }
            checkBox1_CheckedChanged(sender, e);
        }

        private void radioButton9_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void radioButton11_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void radioButton13_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void checkBox40_CheckedChanged(object sender, EventArgs e)
        {
            textBox41.Enabled = checkBox40.Checked;
            if (!checkBox40.Checked)
                textBox41.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox39_CheckedChanged(object sender, EventArgs e)
        {
            textBox42.Enabled = checkBox39.Checked;
            if (!checkBox39.Checked)
                textBox42.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox38_CheckedChanged(object sender, EventArgs e)
        {
            textBox43.Enabled = checkBox38.Checked;
            if (!checkBox38.Checked)
                textBox43.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox41_CheckedChanged(object sender, EventArgs e)
        {
            textBox44.Enabled = checkBox41.Checked;
            if (!checkBox41.Checked)
                textBox44.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox42_CheckedChanged(object sender, EventArgs e)
        {
            textBox45.Enabled = checkBox42.Checked;
            if (!checkBox42.Checked)
                textBox45.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox43_CheckedChanged(object sender, EventArgs e)
        {
            textBox46.Enabled = checkBox43.Checked;
            if (!checkBox43.Checked)
                textBox46.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox44_CheckedChanged(object sender, EventArgs e)
        {
            textBox47.Enabled = checkBox44.Checked;
            textBox48.Enabled = checkBox44.Checked;
            textBox49.Enabled = checkBox44.Checked;
            textBox50.Enabled = checkBox44.Checked;
            textBox51.Enabled = checkBox44.Checked;
            textBox52.Enabled = checkBox44.Checked;
            textBox53.Enabled = checkBox44.Checked;
            textBox54.Enabled = checkBox44.Checked;
            if (!checkBox44.Checked)
            {
                textBox47.Clear();
                textBox48.Clear();
                textBox49.Clear();
                textBox50.Clear();
                textBox51.Clear();
                textBox52.Clear();
                textBox53.Clear();
                textBox54.Clear();
            }
            checkBox1_CheckedChanged(sender, e);
        }

        private void checkBox45_CheckedChanged(object sender, EventArgs e)
        {
            textBox55.Enabled = checkBox45.Checked;
            textBox56.Enabled = checkBox45.Checked;
            textBox57.Enabled = checkBox45.Checked;
            textBox58.Enabled = checkBox45.Checked;
            textBox59.Enabled = checkBox45.Checked;
            if (!checkBox45.Checked)
            {
                textBox55.Clear();
                textBox56.Clear();
                textBox57.Clear();
                textBox58.Clear();
                textBox59.Clear();
            }
            checkBox1_CheckedChanged(sender, e);
        }

        private void InitialClinicalDataView_FormClosing(object sender, FormClosingEventArgs e)
        {

            if (isModified)
            {
                DialogResult res = uiUtility.confirmSaveDialog();
                if (res != DialogResult.Cancel)
                {
                    if (res == DialogResult.Yes)
                    {
                        updateHandler();
                    }

                }
                else
                    e.Cancel = true;
            }
        }
        public String[] updateHandler()
        {
            String[] result = null;
            
            pasyenteICD.PatientID = Int32.Parse(last_id);
            pasyenteICD.Chiefcomplaint = textBox1.Text;
            pasyenteICD.Hpi = richTextBox1.Text;
            pasyenteICD.Bcg = checkBox1.Checked;
            pasyenteICD.Dtp = checkBox2.Checked;
            pasyenteICD.Hib = checkBox4.Checked;
            pasyenteICD.Mmr = checkBox6.Checked;
            pasyenteICD.Hpv = checkBox8.Checked;
            pasyenteICD.Opvipv = checkBox3.Checked;
            pasyenteICD.Vari = checkBox7.Checked;
            pasyenteICD.Otherimmunizationcheck = iHOthersheckbox.Checked;
            pasyenteICD.Otherimmunization = iHOtherstextBox.Text;
            pasyenteICD.Familycancerbox = checkBox10.Checked;
            pasyenteICD.Familycancer = textBox3.Text;
            pasyenteICD.Familyhemo = checkBox11.Checked;
            pasyenteICD.Familyvwf = checkBox12.Checked;
            pasyenteICD.Familyanemiabox = checkBox13.Checked;
            pasyenteICD.Familyanemia = textBox4.Text;
            pasyenteICD.Familyothers = checkBox14.Checked;
            pasyenteICD.Familyothersnotes = textBox5.Text;
            pasyenteICD.Pastillnessbox = checkBox15.Checked;
            pasyenteICD.Pastillness = textBox6.Text;
            pasyenteICD.Pastsurgerybox = checkBox16.Checked;
            pasyenteICD.Pastsurgery = textBox7.Text;
            pasyenteICD.Pastmedicationsbox = checkBox17.Checked;
            pasyenteICD.Pastmedications = textBox8.Text;
            pasyenteICD.Pastallergybox = checkBox18.Checked;
            pasyenteICD.Allergies = richTextBox4.Text;
            pasyenteICD.Envirohistory = richTextBox2.Text;
            pasyenteICD.Psychohistory = richTextBox3.Text;
            pasyenteICD.Vitalt = textBox9.Text;
            pasyenteICD.Vitalbsa = textBox10.Text;
            pasyenteICD.Vitalbp = textBox11.Text;
            pasyenteICD.Vitalhr = textBox12.Text;
            pasyenteICD.Vitalpain = textBox13.Text;
            pasyenteICD.Vitalrr = textBox14.Text;
            pasyenteICD.Vitalheight = textBox15.Text;
            pasyenteICD.Vitalweight = textBox16.Text;
            pasyenteICD.Vitalperform_lev = textBox17.Text;
            
            pasyenteICD.Skinlesions = radioButton2.Checked;
            pasyenteICD.Skinlesionsnotes = textBox18.Text;
            pasyenteICD.Skinnolesions = radioButton1.Checked;
            pasyenteICD.Skinlocation = textBox19.Text;
            pasyenteICD.Heent_conj_normal = checkBox19.Checked;
            pasyenteICD.Heent_conj_pale = checkBox20.Checked;
            pasyenteICD.Heent_sclerae_normal = checkBox21.Checked;
            pasyenteICD.Heent_sclerae_yellow = checkBox23.Checked;
            pasyenteICD.Heent_thyr_normal = checkBox22.Checked;
            pasyenteICD.Heent_thyr_enlarged = checkBox24.Checked;
            pasyenteICD.Heent_thyr_enlargednotes = textBox20.Text;
            pasyenteICD.Heent_crn_normal = checkBox25.Checked;
            pasyenteICD.Heent_crn_enlarged = checkBox26.Checked;
            pasyenteICD.Heent_crn_enlargednotes = textBox21.Text;
           
                pasyenteICD.Heent_tonsils_normal = checkBox28.Checked;
            
                pasyenteICD.Heent_tonsils_enlarged = checkBox27.Checked;
            
                pasyenteICD.Heent_tonsils_exudates = checkBox29.Checked;
            
                pasyenteICD.Heent_tonsils_beefy = checkBox30.Checked;
            
                pasyenteICD.Heent_tm_normal = checkBox31.Checked;
            
                pasyenteICD.Heent_tm_perforated = checkBox32.Checked;
            
                pasyenteICD.Heent_tm_discharged = checkBox33.Checked;
                            pasyenteICD.Chestrythm_regu = checkBox34.Checked;
            
                pasyenteICD.Chestrythm_irreg = checkBox35.Checked;
            
                pasyenteICD.Chestrythm_murmur = checkBox36.Checked;
            
                pasyenteICD.Chestrythm_thrill = checkBox37.Checked;
            pasyenteICD.Chestbreast_smr = textBox22.Text;
            
                pasyenteICD.Lungsnormal = radioButton4.Checked;
            
            
                pasyenteICD.Lungsabnormal = radioButton3.Checked;
  
            
            pasyenteICD.Lungsabnormalnotes = textBox24.Text;
            
                pasyenteICD.Extremitiesnormal = radioButton6.Checked;
            
                pasyenteICD.Extremitiesabnormal = radioButton5.Checked;
                
            
            pasyenteICD.Extremitiesabnormalnotes = textBox23.Text;
            
                pasyenteICD.Rectalnormal = radioButton8.Checked;
            
                pasyenteICD.Rectalabnormal = radioButton7.Checked;
                
            
            pasyenteICD.Rectalabnormalnotes = textBox25.Text;
            
                pasyenteICD.Endocrinenormal = radioButton10.Checked;
           
                pasyenteICD.Endocrineabnormal = radioButton9.Checked;
                
            
            pasyenteICD.Endocrineabnormalnotes = textBox26.Text;
            
                pasyenteICD.Hematologicnormal = radioButton12.Checked;
            
                pasyenteICD.Hematologicabnormal = radioButton11.Checked;
                
            
            pasyenteICD.Hematologicabnormalnotes = richTextBox5.Text;
            
                pasyenteICD.Genitalianormal = radioButton14.Checked;

                pasyenteICD.Genitaliaabnormal = radioButton13.Checked;
             
            pasyenteICD.Genitaliaabnormalnotes = textBox27.Text;
            pasyenteICD.Smrrating = textBox28.Text;
            pasyenteICD.Phys_others = richTextBox6.Text;
            pasyenteICD.Phys_perflevel = richTextBox7.Text;
            pasyenteICD.Cbchgb = textBox37.Text;
            pasyenteICD.Cbchct = textBox35.Text;
            pasyenteICD.Cbcwbc = textBox33.Text;
            pasyenteICD.Cbcstabs = textBox32.Text;
            pasyenteICD.Cbcseg = textBox29.Text;
            pasyenteICD.Cbcl = textBox30.Text;
            pasyenteICD.Cbcplatelet = textBox31.Text;
            pasyenteICD.Cbcm = textBox34.Text;
            pasyenteICD.Cbce = textBox36.Text;
            pasyenteICD.Cbcblast = textBox38.Text;
            pasyenteICD.Cbcreticulyte_count = textBox39.Text;
            pasyenteICD.Cbcrpi = textBox40.Text;
            
                pasyenteICD.Cbcmcv = checkBox38.Checked;
                
            
            pasyenteICD.Cbcmcvnotes = textBox43.Text;
            
                pasyenteICD.Cbcmch = checkBox39.Checked;
                
            
            pasyenteICD.Cbcmchnotes = textBox42.Text;
            
                pasyenteICD.Cbcmchc = checkBox40.Checked;
                
            
            pasyenteICD.Cbcmchcnotes = textBox41.Text;
            
                pasyenteICD.Perismearrbc = checkBox41.Checked;
                
            
            pasyenteICD.Perismearrbcnotes = textBox44.Text;
           
            pasyenteICD.Perismearaniso = checkBox24.Checked;
            pasyenteICD.Perismearanisonotes = textBox45.Text;
                pasyenteICD.Perismearpoikilo = checkBox43.Checked;
                

            
            pasyenteICD.Perismearpoikilonotes = textBox46.Text;
            
                pasyenteICD.Perismearwbc = checkBox44.Checked;
                

            
            pasyenteICD.Perismearwbcnotes = textBox47.Text;
            pasyenteICD.Perismearb = textBox48.Text;
            pasyenteICD.Perismearn = textBox49.Text;
            pasyenteICD.Perismearl = textBox50.Text;
            pasyenteICD.Perismear2b = textBox51.Text;
            pasyenteICD.Perismeare = textBox52.Text;
            pasyenteICD.Perismearm = textBox53.Text;
            pasyenteICD.Perismearblast = textBox54.Text;
            
                pasyenteICD.Perismearplatelets = checkBox45.Checked;
            pasyenteICD.Perismearadeq = textBox55.Text;
            pasyenteICD.Perismearinc = textBox56.Text;
            pasyenteICD.Perismeardec = textBox57.Text;
            pasyenteICD.Perismearmacro = textBox58.Text;
            pasyenteICD.Perismearmicro = textBox59.Text;
            pasyenteICD.Perismearinterpre = richTextBox8.Text;
            pasyenteICD.Coagprofblledtime = textBox61.Text;
            pasyenteICD.Coagprofclottime = textBox62.Text;
            pasyenteICD.Coagprofpt = textBox64.Text;
            pasyenteICD.Coagprofaptt = textBox65.Text;
            pasyenteICD.Coagproffdp = textBox66.Text;
            pasyenteICD.Coagprofothers = textBox67.Text;
            pasyenteICD.Coagprofviii = textBox62.Text;
            pasyenteICD.Coagprofix = textBox63.Text;
            pasyenteICD.Coagproffibri = textBox68.Text;
            pasyenteICD.Coagprofdmmers = textBox69.Text;
            pasyenteICD.Plateaggregationtests = richTextBox9.Text;
            pasyenteICD.Hemoglobinelectronotes = richTextBox10.Text;
            pasyenteICD.Bonemsmerythropoiesis = textBox70.Text;
            pasyenteICD.Bonemsmgranulopoiesis = textBox71.Text;
            pasyenteICD.Bonemsmmegakaryopoiesis = textBox72.Text;
            pasyenteICD.Bonemsmothers = textBox73.Text;
            pasyenteICD.Bonemsminterpretations = textBox74.Text;
            pasyenteICD.Bonemrbiopsydate = DateTime.Parse(dateTimePicker1.Value.ToString());
            pasyenteICD.Bonemrbiopsynotes = richTextBox11.Text;
            pasyenteICD.Histopathologydate = DateTime.Parse(dateTimePicker2.Value.ToString());
            pasyenteICD.Histopathologynotes = richTextBox12.Text;
            pasyenteICD.Chromodate = DateTime.Parse(dateTimePicker3.Value.ToString());
            pasyenteICD.Chromonotes = richTextBox13.Text;
            pasyenteICD.Cytochemdate = DateTime.Parse(dateTimePicker4.Value.ToString());
            pasyenteICD.Cytochempas = textBox75.Text;
            pasyenteICD.Cytochemmpo = textBox76.Text;
            pasyenteICD.Cytochemsbb = textBox77.Text;
            pasyenteICD.Cytochemothers = textBox78.Text;

            pasyenteICD.Immunophenodate = DateTime.Parse(dateTimePicker5.Value.ToString());
            pasyenteICD.Immunophenocd3 = textBox79.Text;
            pasyenteICD.Immunophenocd5 = textBox80.Text;
            pasyenteICD.Immunophenocd7 = textBox81.Text;
            pasyenteICD.Immunophenocd10 = textBox82.Text;
            pasyenteICD.Immunophenocd13= textBox83.Text;
            pasyenteICD.Immunophenocd19 = textBox85.Text;
            pasyenteICD.Immunophenocd20 = textBox86.Text;
            pasyenteICD.Immunophenocd22= textBox87.Text;
            pasyenteICD.Immunophenocd33 = textBox88.Text;
            pasyenteICD.Immunophenocd34 = textBox89.Text;
            pasyenteICD.Immunophenoantihladr = textBox90.Text;
            pasyenteICD.Immunophenoothers = textBox91.Text;

            pasyenteICD.Bonescandate = DateTime.Parse(dateTimePicker8.Value.ToString());
            pasyenteICD.Bonescannotes = richTextBox16.Text;
            pasyenteICD.Ctscandate = DateTime.Parse(dateTimePicker7.Value.ToString());
            pasyenteICD.Ctscannotes = richTextBox15.Text;
            pasyenteICD.Chestxraydate = DateTime.Parse(dateTimePicker6.Value.ToString());
            pasyenteICD.Chestxraynotes = richTextBox14.Text;
            pasyenteICD.Labdataothers = richTextBox17.Text;
            pasyenteICD.Impressiondiagnosis = textBox92.Text;
            pasyenteICD.Othernotes = textBox93.Text;
            
            bool isAdded = icdprocessor.updateICD(pasyenteICD);
            return result;
        }
        public void addTempHandler(String lastID, icdController icdCon)
        {
            tempporocessor = icdCon;
            templast_id = lastID;
            
            bool isAdded = tempporocessor.addTemp(Int32.Parse(templast_id));
        }
        private void groupBox6_Enter(object sender, EventArgs e)
        {

        }

        private void InitialClinicalDataView_Load(object sender, EventArgs e)
        {
            ToolTip t1 = uiUtility.tooltips();
            t1.SetToolTip(this.button6, "Back");
        }

        private void radioButton9_CheckedChanged_1(object sender, EventArgs e)
        {
            textBox26.Enabled = radioButton9.Checked;
            if (!radioButton9.Checked)
                textBox26.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void radioButton11_CheckedChanged_1(object sender, EventArgs e)
        {
            richTextBox5.Enabled = radioButton11.Checked;
            if (!radioButton11.Checked)
                richTextBox5.Clear();
            checkBox1_CheckedChanged(sender, e);
        }

        private void radioButton13_CheckedChanged_1(object sender, EventArgs e)
        {
            textBox27.Enabled = radioButton13.Checked;
            if (!radioButton13.Checked)
                textBox27.Clear();
            checkBox1_CheckedChanged(sender, e);
        }


    }
}
